import QtQuick 1.0

//This is simply an InnerActiveAd with a timer which will load a new ad
//defaults to 2 mins

Item {
    id: adWrapper

    //specific to the timed ads
    property int interval: 120          //reload ad every x seconds
    property bool autoStart: true       //autostart

    //aliased to the ad properties so they can be set here but reflected in the child
    property alias appid: ad.appid

    //these probably don't need to be specified
    property alias channelid: ad.channelid

    property alias screenWidth: ad.screenWidth
    property alias screenHeight: ad.screenHeight





    InnerActiveAd {
        id: ad
        width: parent.width
        height: parent.height

    }

    Timer {
        id: adTimer
        repeat: true
        interval: parent.interval * 1000 //in seconds

        onTriggered: {
            ad.loadAd();
        }
    }

    function stop() {
        adTimer.stop();
    }

    function start() {
        adTimer.start();
    }

    Component.onCompleted: { ad.loadAd(); if(autoStart == true) { adTimer.start(); } }
}
